import React, { useMemo } from 'react';
import { View } from '@tarojs/components';
import { toValidScalePX } from '@/utils';
import './index.scss';
import { placeStyle } from './constants';

const ModuleTitle = ({ componentCfg = {} }) => {
  const { styleSettingRender: styleRender, content } = componentCfg;
  const wrapStyles = useMemo(() => {
    return {
      height: toValidScalePX(styleRender.blankHeight),
      backgroundColor: styleRender.backgroundColor,
    };
  }, [styleRender]);
  const lineStyles = useMemo(() => {
    return {
      borderTopColor: styleRender.color,
      borderTopStyle: styleRender.borderTopStyle,

    };
  }, [styleRender]);

  return (
    <View className="ModulePlace" style={wrapStyles}>
      {placeStyle.two === styleRender.style && <View className="line" style={lineStyles}></View>}
    </View>
  );
};
export default ModuleTitle;
